package com.xxw.yygh.oss.controller;

import com.xxw.yygh.common.result.R;
import com.xxw.yygh.oss.service.OssService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user/oss/file")
public class OssController {

    @Resource
    private OssService ossService;

    @PostMapping("/upload")
    public R upload(MultipartFile file){

        String url=ossService.upload(file);
        return R.ok().data("url",url);

    }

}
